package com.zhongge.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongge.entity.Dest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongge.entity.Student;
import com.zhongge.vo.DestInfoVO;
import com.zhongge.vo.HistoryDestInfoVO;
import com.zhongge.vo.StuDestVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhongge
 * @since 2025-11-09
 */
public interface DestMapper extends BaseMapper<Dest> {
    //根据假期id查询出所有的学生去向
    List<DestInfoVO> getDestInfoByHolidayId(@Param("id") Integer id);

    //查询出所有状态为1的假期
    @Select("select holiday.id as id," +
            " dict.`describe` as name," +
            " holiday.holiday_begin as startDate," +
            " holiday.holiday_end as endDate," +
            " holiday.holiday_dest_register_begin as registerStart," +
            " holiday.holiday_dest_register_end as registerEnd," +
            " holiday.state as status" +
            " from t_holiday as holiday" +
            " left join t_dict as dict on dict.table_name ='t_holiday'" +
            " and dict.field_name='holiday_value'" +
            " and holiday.holiday_value=dict.value" +
            " where holiday.state=1")
    IPage<StuDestVO> getHolidayOfSTatu(Page<StuDestVO> page,Integer pageNumber, Integer pageSize);

    IPage<HistoryDestInfoVO> getHistoryDestInfo(Page<HistoryDestInfoVO> page,
                                               Integer pageNumber,
                                               Integer pageSize,
                                               @Param("stuId") Integer stuId);
}
